#ifndef __WD_BLOCKQ_H
#define __WD_BLOCKQ_H
#include <func.h>

#define MAXLEN 1024
// 定义结构体和对外的接口(API)

typedef int E;

typedef struct {
	E elements[MAXLEN];
	int front;
	int rear;
	int size;
	pthread_cond_t not_empty;
	pthread_cond_t not_full;
	pthread_mutex_t mutex;
} BlockQ;

BlockQ* blockq_create(void);
void    blockq_destroy(BlockQ* q);

bool blockq_empty(BlockQ* q);
bool blockq_full(BlockQ* q);
void blockq_push(BlockQ* q, E val);
E blockq_pop(BlockQ* q);
E blockq_peek(BlockQ* q);

#endif
